package com.android.yinghebike.manager;

import com.android.baselibrary.tool.SPUtil;
import com.android.yinghebike.MyApplication;
import com.android.yinghebike.constants.SPConstants;

import java.util.Locale;

//语言管理类
public class LanguageManager {

    //从配置获取用户设置的语言
    public static int getLanguageType() {
        int languageType = SPUtil.getIntValue(MyApplication.context, SPConstants.Setting_Language, 0);
        return languageType;
    }

    //设置语言到本地配置
    public static void setLanguageType(int languageType) {
        SPUtil.putValue(MyApplication.context, SPConstants.Setting_Language, languageType);
    }

    //获取设置的语言对象   0:英文   1：中文
    public static Locale getLocale() {
        int languageType = getLanguageType();
        if (languageType == 0) {
            return Locale.ENGLISH;
        } else {
            return Locale.CHINA;
        }
    }


}
